package com.ybwh.springboot2.demo;


import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.ybwh.springboot2.common.jackson.localdatetime.EndOfDayLocalDateTimeDeserializer;
import com.ybwh.springboot2.common.jackson.localdatetime.StartOfDayLocalDateTimeDeserializer;
import com.ybwh.springboot2.common.jackson.trim.Trim;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;

@Data
public class AreaVo {


    @Trim
    @NotBlank(message = "不能为空")
    @Size(min = 5, message = "长度至少为5")
    @ApiModelProperty(value = "地区名")
    private String areaName;


    @ApiModelProperty(value = "地区编码")
    private Integer areaCode;


    @JsonFormat(pattern = "yyyy-MM-dd")
    @JsonDeserialize(using = StartOfDayLocalDateTimeDeserializer.class)
    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTimeMin;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @JsonDeserialize(using = EndOfDayLocalDateTimeDeserializer.class)
    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTimeMax;


    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }
}